import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 29/09/11
 * Time: 18.58
 * To change this template use File | Settings | File Templates.
pippo pluto paperino
 */
public class MainProblema1 {

        public static void main(String []args )
        {

            Scanner in = new Scanner(System.in);

            System.out.println("Dammi il primo intero:");
            int n= in.nextInt();

            System.out.println("Dammi il secondo intero:");
            int m= in.nextInt();

            if ((n%m)==0)
            {
                System.out.println("n e m sono divisibili");
                System.out.println(CalcolaRadice(n,m));
            }
            if ((n%m)!=0)
            {
                System.out.println("n e m NON sono divisibili");
                System.out.println(CalcolaLogaritimo(n,m));
            }
        }
    public static double CalcolaRadice(int n, int m )
    {
        double p1 = Math.pow(m,(Math.sin(n*(Math.PI/6.0))));
        double p2 = Math.ceil((double)(n+1)/(m));
        return (Math.sqrt(p1+p2));
    }

    public static double CalcolaLogaritimo(int n, int m)
    {
        return Math.log10((double)(n%m));
    }
}
